package cn.iocoder.yudao.module.xiaoBizHandler.convert.attach;

import cn.iocoder.yudao.module.xiaoBizHandler.controller.admin.attach.vo.AttachRespVO;
import cn.iocoder.yudao.module.xiaoBizHandler.dal.dataobject.attach.AttachDO;
import cn.iocoder.yudao.module.xiaoBizHandler.service.attach.AttachService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class AttachConvertCustomerImpl implements AttachConvertCustomer {

    @Resource
    AttachService attachService;

    @Override
    public AttachRespVO convert(AttachDO bean) {
        if ( bean == null ) {
            return null;
        }

        AttachRespVO attachRespVO = new AttachRespVO();

        attachRespVO.setAttachName( bean.getAttachName() );
        attachRespVO.setAttachSuffix( bean.getAttachSuffix() );
        attachRespVO.setAttachOwnerId( bean.getAttachOwnerId() );
        attachRespVO.setAttachPath( bean.getAttachPath() );
        attachRespVO.setAttachType( bean.getAttachType() );
        attachRespVO.setAttachSize( bean.getAttachSize() );
        attachRespVO.setReferId( bean.getReferId() );
        attachRespVO.setRegionId( bean.getRegionId() );
        attachRespVO.setLastTime( bean.getLastTime() );
        attachRespVO.setNowYear( bean.getNowYear() );
        attachRespVO.setIsCopy( bean.getIsCopy() );
        attachRespVO.setWaterMark( bean.getWaterMark() );
        attachRespVO.setRegionName( bean.getRegionName() );
        attachRespVO.setMoveNewRegionId( bean.getMoveNewRegionId() );
        attachRespVO.setId( bean.getId() );
        attachRespVO.setFileAbsolutePathFormatter(attachService.getAttachPath(bean.getId()));

        return attachRespVO;
    }


}
